from django.db import models

class Item(models.Model):
    name = models.CharField(max_length = 100)
    stock = models.IntegerField(default = 0)

    def __unicode__(self):
        return self.name

class Client(models.Model):
    name = models.CharField(max_length = 150)
    address = models.CharField(max_length = 150)
    phone = models.CharField(max_length = 20)

    def __unicode__(self):
        return self.name
    
class Inventory(models.Model):
    client = models.ForeignKey(Client)
    creation_date = models.DateTimeField('Creation Date')
    
class Link(models.Model):
    inventory = models.ForeignKey(Inventory)
    item = models.ForeignKey(Item)
    quantity = models.IntegerField(default = 0)
    unit_price = models.IntegerField(default = 0)
    
    
    



